package owg.util.editor2d;

import java.util.HashMap;

public class Boxed {
    private static final HashMap<Class<?>, Class<?>> boxed = new HashMap<>();
    static
    {
	boxed.put(byte.class, Byte.class);
	boxed.put(short.class, Short.class);
	boxed.put(int.class, Integer.class);
	boxed.put(long.class, Long.class);
	boxed.put(boolean.class, Boolean.class);
	boxed.put(float.class, Float.class);
	boxed.put(double.class, Double.class);
    }
    @SuppressWarnings("unchecked")
    public static<B> Class<B> getBoxedType(Class<B> primitiveType) {
	assert primitiveType.isPrimitive();
	assert boxed.containsKey(primitiveType);
	return (Class<B>) boxed.get(primitiveType);
    }
}
